/**
 * Project Name:OrderServiceImpl.java
 * File Name:OrderServiceImpl.java
 * Date:2018/8/1 上午9:30
 * Copyright (c) 2018, zhang.xiangyu@foxmail.com All Rights Reserved.
*/
package com.meatball.base.pay.order.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.meatball.base.pay.order.dao.PayOrderMapper;
import com.meatball.base.pay.order.model.PayOrder;
import com.meatball.base.pay.order.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Title: OrderServiceImpl.java
 * @Description: todo(订单实现)
 * @Author 張翔宇
 * @Date 2018/8/1 上午9:30
 * @Version V1.0
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private PayOrderMapper mapper;

    @Override
    public Map<String, Object> table(PayOrder record) {
        PageInfo<PayOrder> list = PageHelper.startPage(record.getOffset(), record.getLimit()).doSelectPageInfo(() -> mapper.selectList(record));
        Map<String, Object> result = new HashMap<>(4);
        result.put("code", 200);
        result.put("msg", "");
        result.put("count", list.getTotal());
        result.put("data", list.getList());
        return result;
    }
}
